﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="RoundedCorners.aspx.cs" Inherits="Samples.Views.Samples.RoundedCorners" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <div class="demoarea">
        <div class="demoheading">RoundedCorners</div>        
        
        <div id="Panel1" class="roundedPanel" style="width:330px;">
            <div style="padding: 10px; text-align: center">
                <div style="padding: 5px; border: solid black thin; background-color: #B4B4B4;">
                    <%= Html.Image("/Content/Images/AJAX.gif") %><br />
                    ASP.NET AJAX
                </div>
            </div>
        </div>
        
        <br />
        <fieldset>
            <legend>Options</legend>
            
            Radius:<br />
            <%= Html.RadioButton("radius", "None", "0") %>
            <%= Html.RadioButton("radius", "2px", "2") %>
            <%= Html.RadioButton("radius", "4px", "4") %>
            <%= Html.RadioButton("radius", "6px", "6", true) %>
            <%= Html.RadioButton("radius", "10px", "10") %>
            <br /><br />
            
            Corners:<br />
            <%= Html.CheckBox("chkTopLeft", "Top Left", "1", true) %>
            <%= Html.CheckBox("chkTopRight", "Top Right", "2", true) %><br />
            <%= Html.CheckBox("chkBottomLeft", "Bottom Left", "8", true) %>
            <%= Html.CheckBox("chkBottomRight", "Bottom Right", "4", true) %>
            <br /><br />
            
            Border Color:<br />
            <%= Html.RadioButton("border", "None", "") %>
            <%= Html.RadioButton("border", "Black", "Black") %>
            <%= Html.RadioButton("border", "Red", "Red") %>
            <%= Html.RadioButton("border", "Aqua", "Aqua") %>
            <br /><br />
            
            <input type="button" value="Set Options" onclick="setOptions();" />
            <br /><br />
        </fieldset>
    </div>
    
    <script type="text/javascript" language="javascript">
    //<![CDATA[
        function setOptions() {
            var rc = $find('Panel1_javascript_id');

            //handle border
            rc.set_BorderColor(getSelectedItem(document.getElementsByName("border")).value);

            //handle corners
            rc.setCorner($get('chkTopLeft').value, $get('chkTopLeft').checked);
            rc.setCorner($get('chkTopRight').value, $get('chkTopRight').checked);
            rc.setCorner($get('chkBottomLeft').value, $get('chkBottomLeft').checked);
            rc.setCorner($get('chkBottomRight').value, $get('chkBottomRight').checked);

            //handle radius
            rc.set_Radius(getSelectedItem(document.getElementsByName('radius')).value);
        }

        function getSelectedItem(elm) {
            var childIndex = "";
            for (var i = 0; i < elm.length; i++) {
                if (elm[i].checked) {
                    childIndex = elm[i];
                    break;
                }
            }

            return childIndex;
        }
    //]]>
    </script>
    <%= Ajax.RoundedCorners("Panel1") %>
</asp:Content>